home *** CD-ROM | disk | FTP | other *** search
- /*-
- * main.c --
- * First-level boot program for Sprite. Takes its arguments
- * and uses tftp to download the appropriate kernel image.
- *
- * Copyright (c) 1987 by the Regents of the University of California
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- *
- */
- #ifndef lint
- static char rcsid[] =
- "$Header$ SPRITE (Berkeley)";
- #endif lint
-
- #include "boot.h"
-
- #include "saio.h"
- #include "bootparam.h"
-
- /*-
- *-----------------------------------------------------------------------
- * main --
- * Main function for downloading stuff.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Begins the booted program.
- *
- *-----------------------------------------------------------------------
- */
- main()
- {
- register struct bootparam *bp = *romp->v_bootparam;
- struct saioreq req;
- int startAddr;
-
-
- if ((strcmp(bp->bp_name, "vmunix") == 0) || (*bp->bp_name == '\0')) {
- bp->bp_name = "sprite";
- }
-
- printf ("SpriteBoot: %c%c(%x,%x,%x)%s\n",
- bp->bp_dev[0], bp->bp_dev[1], bp->bp_ctlr,
- bp->bp_unit, bp->bp_part, bp->bp_name);
-
- req.si_ctlr = bp->bp_ctlr;
- req.si_unit = bp->bp_unit;
- req.si_boff = (daddr_t)bp->bp_part;
- req.si_boottab = bp->bp_boottab;
-
- if (devopen(&req)) { /* Do all the hard work */
- (*romp->v_exit_to_mon)();
- }
- etheropen( &req);
- startAddr = tftpload(&req, bp);
- devclose(&req);
-
- if (startAddr == -1){
- (*romp->v_exit_to_mon)();
- } else {
- /*
- * Jump to the address returned by tftpload
- */
- printf("Starting execution at 0x%x\n", startAddr);
- startKernel(startAddr);
- return(startAddr);
- }
- }
-